Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: Move ConnectionId and PendingPoint to libp2p-swarm #3346

Merged
merged 13 commits into from
Jan 18, 2023

Conversation

thomaseizinger
Copy link
Contributor

Description

Both of these are only needed as part of libp2p-swarm. Them residing in libp2p-core is a left-over from when libp2p-core still contained Pool.

Notes

2nd attempt of getting #3221 in.

Links to any relevant issues

Open Questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@thomaseizinger thomaseizinger changed the title refactor!: Move ConnectionId and PendingPoint to `libp2p-swarm refactor!: Move ConnectionId and PendingPoint to libp2p-swarm Jan 18, 2023
@mergify
Copy link
Contributor

mergify bot commented Jan 18, 2023

This pull request has merge conflicts. Could you please resolve them @thomaseizinger? 🙏

@mergify
Copy link
Contributor

mergify bot commented Jan 18, 2023

This pull request has merge conflicts. Could you please resolve them @thomaseizinger? 🙏

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to ignore comments. Good to merge from my end. Neat little step forward!

# 0.39.0 [unreleased]

- Move `ConnectionId` to `libp2p-swarm`. See [PR 3221].
- Move `PendingPoint` to `libp2p-swarm` and make it crate-private. See [PR 3221].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh cool, didn't know that it is not exposed from libp2p-swarm.

Comment on lines +60 to +61
/// in test environments. There is in general no guarantee
/// that all connection IDs are based on non-negative integers.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the "non-negative" still up to date?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this is here, I just moved the code.

Will update as part of #3327.

pub struct ConnectionId(usize);

impl ConnectionId {
/// Creates a `ConnectionId` from a non-negative integer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Creates a `ConnectionId` from a non-negative integer.
/// Creates a [`ConnectionId`] from a non-negative integer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will go away in #3327 so I am not gonna bother :)

Comment on lines +67 to +74
impl std::ops::Add<usize> for ConnectionId {
type Output = Self;

fn add(self, other: usize) -> Self {
Self(self.0 + other)
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remind me, when do we add two ConnectionIds? Or is this just to get the next one? In the latter case, it would not make sense to implement the public Add trait, right? (Feel free to ignore in this pull request.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will get removed in #3327.

In this PR, I am just moving things around without touching functionality!

@mergify mergify bot merged commit 475dc80 into master Jan 18, 2023
@mergify mergify bot deleted the move-connection-id branch January 18, 2023 08:56
umgefahren pushed a commit to umgefahren/rust-libp2p that referenced this pull request Mar 8, 2024
…ibp2p#3346)

Both of these are only needed as part of `libp2p-swarm`. Them residing in `libp2p-core` is a left-over from when `libp2p-core` still contained `Pool`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants